subroutine secant(fungsi, x0, x1, x, eps, eps_mesin)
	implicit none
	DOUBLE PRECISION fungsi, x0, x1, x, x_sebelumnya, y0, y1, eps, eps_mesin
	logical berhenti
	integer*2 counter
	counter = 0
	berhenti = .FALSE.
	print*, "i  ","   x(r)    ", "   |x(r+1)-x(r)| "
	do
		x_sebelumnya = x1
		y0 = fungsi(x0)
		y1 = fungsi(x1)
		if (abs(y1-y0).LT.eps_mesin) then
			berhenti = .TRUE.
			x = 9999
		else
			x = x - (y1*(x1-x0)/(y1-y0))
			x0 = x1
			x1 = x
		end if	
		print*, counter, x, abs(x-x_sebelumnya)
		counter = counter + 1
		if ((abs(x-x_sebelumnya).LT.eps).OR.berhenti) then
			exit
		end if
	end do
end